package cc.comac.mom.service.impl;

import java.io.IOException;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import cc.comac.mom.api.QualityAsrFeaturesService;
import cc.comac.mom.bean.QualityAsrFeatures;
import cc.comac.mom.datahandlers.entity.QualityAsrFeaturesDataHandler;
import cc.comac.mom.util.ResultBean;
@RestController
@Service
public class QualityAsrFeaturesServiceImpl implements QualityAsrFeaturesService{
	@Autowired
	private QualityAsrFeaturesDataHandler qualityAsrFeaturesDataHandler;

	@Override
	public ResultBean insertBatch(@RequestBody List<QualityAsrFeatures> qualityAsrFeaturesList) {
		ResultBean resultBean = new ResultBean(true);
		int insertBatch = qualityAsrFeaturesDataHandler.insertBatch(qualityAsrFeaturesList);
		resultBean.setObject(insertBatch);
		return resultBean;
	}

	@Override
	public ResultBean selectAllByPage(@RequestBody QualityAsrFeatures QualityAsrFeatures) {
		ResultBean resultBean = new ResultBean(true);
		QualityAsrFeatures selectAllByPage = qualityAsrFeaturesDataHandler.selectAllByPage(QualityAsrFeatures);
		resultBean.setObject(selectAllByPage);
		return resultBean;
	}

	@Override
	public ResultBean insert(@RequestBody QualityAsrFeatures QualityAsrFeatures) {
		ResultBean resultBean = new ResultBean(true);
		int insert = qualityAsrFeaturesDataHandler.insert(QualityAsrFeatures);
		resultBean.setObject(insert);
		return resultBean;
	}

	@Override
	public ResultBean update(@RequestBody QualityAsrFeatures QualityAsrFeatures) {
		ResultBean resultBean = new ResultBean(true);
		int update = qualityAsrFeaturesDataHandler.update(QualityAsrFeatures);
		resultBean.setObject(update);
		return resultBean;
	}

	@Override
	public ResultBean batchDelete(@RequestBody List<QualityAsrFeatures> QualityAsrFeaturesList) {
		ResultBean resultBean = new ResultBean(true);
		int batchDelete = qualityAsrFeaturesDataHandler.batchDelete(QualityAsrFeaturesList);
		resultBean.setObject(batchDelete);
		return resultBean;
	}

	@Override
	public String exportData(HttpServletRequest request, HttpServletResponse response, @RequestBody QualityAsrFeatures obj) {
		String exportData = qualityAsrFeaturesDataHandler.exportData(request, response, obj);
		return exportData;
	}

	@Override
	public ResultBean importEquipDevType(MultipartFile file, String rootPath) throws IOException {
		ResultBean importEquipDevType = qualityAsrFeaturesDataHandler.importEquipDevType(file, rootPath);
		return importEquipDevType;
	}

}
